package cn.edu.ctbu.sbadmin.lablog.dao;

import cn.edu.ctbu.sbadmin.common.core.MyMapper;
import cn.edu.ctbu.sbadmin.common.utils.MQuery;
import cn.edu.ctbu.sbadmin.lablog.domain.DimClassDO;
import org.apache.ibatis.annotations.Select;

import java.util.List;


/**
 * 班级课程表DAO接口
 */
public interface DimClassDAO extends MyMapper<DimClassDO> {
    @Select(
            "SELECT DISTINCT\n" +
                    "dim_class.id,\n" +
                    "dim_class.class_name,\n" +
                    "dim_class.course_name,\n" +
                    "dim_class.course_type,\n" +
                    "dim_class.teacher_id,\n" +
                    "dim_class.term_id,\n" +
                    "dim_class.create_time,\n" +
                    "dim_class.class_number,\n" +
                    "dim_term.`name` AS term_name,\n" +
                    "sys_user.truename AS teacher_name\n" +
                    "FROM\n" +
                    "dim_class\n" +
                    "LEFT JOIN dim_term ON dim_term.id = dim_class.term_id\n" +
                    "LEFT JOIN sys_user ON sys_user.id = dim_class.teacher_id"
    )
    public List<DimClassDO> getAll();

    /**
     * 返回所有的分页查询的视图(查询视图)
     * @param mQuery
     * @return
     */
    public List<DimClassDO> listView(MQuery mQuery);

    /**
     * 返回所有的分页查询的总数（查询计数）
     * @param mQuery
     * @return
     */
    public int countView(MQuery mQuery);
}
